<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Exception Region Output (GNU Compiler Collection (GCC) Internals)</title>

<meta name="description" content="Exception Region Output (GNU Compiler Collection (GCC) Internals)">
<meta name="keywords" content="Exception Region Output (GNU Compiler Collection (GCC) Internals)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Option-Index.html" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Assembler-Format.html" rel="up" title="Assembler Format">
<link href="Alignment-Output.html" rel="next" title="Alignment Output">
<link href="Dispatch-Tables.html" rel="prev" title="Dispatch Tables">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>


</head>

<body lang="en">
<div class="subsection-level-extent" id="Exception-Region-Output">
<div class="nav-panel">
<p>
Next: <a href="Alignment-Output.html" accesskey="n" rel="next">Assembler Commands for Alignment</a>, Previous: <a href="Dispatch-Tables.html" accesskey="p" rel="prev">Output of Dispatch Tables</a>, Up: <a href="Assembler-Format.html" accesskey="u" rel="up">Defining the Output Assembler Language</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="Assembler-Commands-for-Exception-Regions"><span>18.20.9 Assembler Commands for Exception Regions<a class="copiable-link" href="#Assembler-Commands-for-Exception-Regions"> &para;</a></span></h4>


<p>This describes commands marking the start and the end of an exception
region.
</p>
<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-EH_005fFRAME_005fSECTION_005fNAME"><span class="category-def">Macro: </span><span><strong class="def-name">EH_FRAME_SECTION_NAME</strong><a class="copiable-link" href="#index-EH_005fFRAME_005fSECTION_005fNAME"> &para;</a></span></dt>
<dd><p>If defined, a C string constant for the name of the section containing
exception handling frame unwind information.  If not defined, GCC will
provide a default definition if the target supports named sections.
<samp class="file">crtstuff.c</samp> uses this macro to switch to the appropriate section.
</p>
<p>You should define this symbol if your target supports DWARF 2 frame
unwind information and the default definition does not work.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-EH_005fFRAME_005fTHROUGH_005fCOLLECT2"><span class="category-def">Macro: </span><span><strong class="def-name">EH_FRAME_THROUGH_COLLECT2</strong><a class="copiable-link" href="#index-EH_005fFRAME_005fTHROUGH_005fCOLLECT2"> &para;</a></span></dt>
<dd><p>If defined, DWARF 2 frame unwind information will identified by
specially named labels.  The collect2 process will locate these
labels and generate code to register the frames.
</p>
<p>This might be necessary, for instance, if the system linker will not
place the eh_frames in-between the sentinals from <samp class="file">crtstuff.c</samp>,
or if the system linker does garbage collection and sections cannot
be marked as not to be collected.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-EH_005fTABLES_005fCAN_005fBE_005fREAD_005fONLY"><span class="category-def">Macro: </span><span><strong class="def-name">EH_TABLES_CAN_BE_READ_ONLY</strong><a class="copiable-link" href="#index-EH_005fTABLES_005fCAN_005fBE_005fREAD_005fONLY"> &para;</a></span></dt>
<dd><p>Define this macro to 1 if your target is such that no frame unwind
information encoding used with non-PIC code will ever require a
runtime relocation, but the linker may not support merging read-only
and read-write sections into a single read-write section.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-MASK_005fRETURN_005fADDR"><span class="category-def">Macro: </span><span><strong class="def-name">MASK_RETURN_ADDR</strong><a class="copiable-link" href="#index-MASK_005fRETURN_005fADDR"> &para;</a></span></dt>
<dd><p>An rtx used to mask the return address found via <code class="code">RETURN_ADDR_RTX</code>, so
that it does not contain any extraneous set bits in it.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-DWARF2_005fUNWIND_005fINFO"><span class="category-def">Macro: </span><span><strong class="def-name">DWARF2_UNWIND_INFO</strong><a class="copiable-link" href="#index-DWARF2_005fUNWIND_005fINFO"> &para;</a></span></dt>
<dd><p>Define this macro to 0 if your target supports DWARF 2 frame unwind
information, but it does not yet work with exception handling.
Otherwise, if your target supports this information (if it defines
<code class="code">INCOMING_RETURN_ADDR_RTX</code> and <code class="code">OBJECT_FORMAT_ELF</code>),
GCC will provide a default definition of 1.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-TARGET_005fEXCEPT_005fUNWIND_005fINFO"><span class="category-def">Common Target Hook: </span><span><code class="def-type">enum unwind_info_type</code> <strong class="def-name">TARGET_EXCEPT_UNWIND_INFO</strong> <code class="def-code-arguments">(struct gcc_options *<var class="var">opts</var>)</code><a class="copiable-link" href="#index-TARGET_005fEXCEPT_005fUNWIND_005fINFO"> &para;</a></span></dt>
<dd><p>This hook defines the mechanism that will be used for exception handling
by the target.  If the target has ABI specified unwind tables, the hook
should return <code class="code">UI_TARGET</code>.  If the target is to use the
<code class="code">setjmp</code>/<code class="code">longjmp</code>-based exception handling scheme, the hook
should return <code class="code">UI_SJLJ</code>.  If the target supports DWARF 2 frame unwind
information, the hook should return <code class="code">UI_DWARF2</code>.
</p>
<p>A target may, if exceptions are disabled, choose to return <code class="code">UI_NONE</code>.
This may end up simplifying other parts of target-specific code.  The
default implementation of this hook never returns <code class="code">UI_NONE</code>.
</p>
<p>Note that the value returned by this hook should be constant.  It should
not depend on anything except the command-line switches described by
<var class="var">opts</var>.  In particular, the
setting <code class="code">UI_SJLJ</code> must be fixed at compiler start-up as C pre-processor
macros and builtin functions related to exception handling are set up
depending on this setting.
</p>
<p>The default implementation of the hook first honors the
<samp class="option">--enable-sjlj-exceptions</samp> configure option, then
<code class="code">DWARF2_UNWIND_INFO</code>, and finally defaults to <code class="code">UI_SJLJ</code>.  If
<code class="code">DWARF2_UNWIND_INFO</code> depends on command-line options, the target
must define this hook so that <var class="var">opts</var> is used correctly.
</p></dd></dl>

<dl class="first-deftypevr">
<dt class="deftypevr" id="index-TARGET_005fUNWIND_005fTABLES_005fDEFAULT"><span class="category-def">Common Target Hook: </span><span><code class="def-type">bool</code> <strong class="def-name">TARGET_UNWIND_TABLES_DEFAULT</strong><a class="copiable-link" href="#index-TARGET_005fUNWIND_005fTABLES_005fDEFAULT"> &para;</a></span></dt>
<dd><p>This variable should be set to <code class="code">true</code> if the target ABI requires unwinding
tables even when exceptions are not used.  It must not be modified by
command-line option processing.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-DONT_005fUSE_005fBUILTIN_005fSETJMP"><span class="category-def">Macro: </span><span><strong class="def-name">DONT_USE_BUILTIN_SETJMP</strong><a class="copiable-link" href="#index-DONT_005fUSE_005fBUILTIN_005fSETJMP"> &para;</a></span></dt>
<dd><p>Define this macro to 1 if the <code class="code">setjmp</code>/<code class="code">longjmp</code>-based scheme
should use the <code class="code">setjmp</code>/<code class="code">longjmp</code> functions from the C library
instead of the <code class="code">__builtin_setjmp</code>/<code class="code">__builtin_longjmp</code> machinery.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-JMP_005fBUF_005fSIZE"><span class="category-def">Macro: </span><span><strong class="def-name">JMP_BUF_SIZE</strong><a class="copiable-link" href="#index-JMP_005fBUF_005fSIZE"> &para;</a></span></dt>
<dd><p>This macro has no effect unless <code class="code">DONT_USE_BUILTIN_SETJMP</code> is also
defined.  Define this macro if the default size of <code class="code">jmp_buf</code> buffer
for the <code class="code">setjmp</code>/<code class="code">longjmp</code>-based exception handling mechanism
is not large enough, or if it is much too large.
The default size is <code class="code">FIRST_PSEUDO_REGISTER * sizeof(void *)</code>.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-DWARF_005fCIE_005fDATA_005fALIGNMENT"><span class="category-def">Macro: </span><span><strong class="def-name">DWARF_CIE_DATA_ALIGNMENT</strong><a class="copiable-link" href="#index-DWARF_005fCIE_005fDATA_005fALIGNMENT"> &para;</a></span></dt>
<dd><p>This macro need only be defined if the target might save registers in the
function prologue at an offset to the stack pointer that is not aligned to
<code class="code">UNITS_PER_WORD</code>.  The definition should be the negative minimum
alignment if <code class="code">STACK_GROWS_DOWNWARD</code> is true, and the positive
minimum alignment otherwise.  See <a class="xref" href="DWARF.html">Macros for DWARF Output</a>.  Only applicable if
the target supports DWARF 2 frame unwind information.
</p></dd></dl>

<dl class="first-deftypevr">
<dt class="deftypevr" id="index-TARGET_005fTERMINATE_005fDW2_005fEH_005fFRAME_005fINFO"><span class="category-def">Target Hook: </span><span><code class="def-type">bool</code> <strong class="def-name">TARGET_TERMINATE_DW2_EH_FRAME_INFO</strong><a class="copiable-link" href="#index-TARGET_005fTERMINATE_005fDW2_005fEH_005fFRAME_005fINFO"> &para;</a></span></dt>
<dd><p>Contains the value true if the target should add a zero word onto the
end of a Dwarf-2 frame info section when used for exception handling.
Default value is false if <code class="code">EH_FRAME_SECTION_NAME</code> is defined, and
true otherwise.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-TARGET_005fDWARF_005fREGISTER_005fSPAN"><span class="category-def">Target Hook: </span><span><code class="def-type">rtx</code> <strong class="def-name">TARGET_DWARF_REGISTER_SPAN</strong> <code class="def-code-arguments">(rtx <var class="var">reg</var>)</code><a class="copiable-link" href="#index-TARGET_005fDWARF_005fREGISTER_005fSPAN"> &para;</a></span></dt>
<dd><p>Given a register, this hook should return a parallel of registers to
represent where to find the register pieces.  Define this hook if the
register and its mode are represented in Dwarf in non-contiguous
locations, or if the register should be represented in more than one
register in Dwarf.  Otherwise, this hook should return <code class="code">NULL_RTX</code>.
If not defined, the default is to return <code class="code">NULL_RTX</code>.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-TARGET_005fDWARF_005fFRAME_005fREG_005fMODE"><span class="category-def">Target Hook: </span><span><code class="def-type">machine_mode</code> <strong class="def-name">TARGET_DWARF_FRAME_REG_MODE</strong> <code class="def-code-arguments">(int <var class="var">regno</var>)</code><a class="copiable-link" href="#index-TARGET_005fDWARF_005fFRAME_005fREG_005fMODE"> &para;</a></span></dt>
<dd><p>Given a register, this hook should return the mode which the
corresponding Dwarf frame register should have.  This is normally
used to return a smaller mode than the raw mode to prevent call
clobbered parts of a register altering the frame register size
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-TARGET_005fINIT_005fDWARF_005fREG_005fSIZES_005fEXTRA"><span class="category-def">Target Hook: </span><span><code class="def-type">void</code> <strong class="def-name">TARGET_INIT_DWARF_REG_SIZES_EXTRA</strong> <code class="def-code-arguments">(tree <var class="var">address</var>)</code><a class="copiable-link" href="#index-TARGET_005fINIT_005fDWARF_005fREG_005fSIZES_005fEXTRA"> &para;</a></span></dt>
<dd><p>If some registers are represented in Dwarf-2 unwind information in
multiple pieces, define this hook to fill in information about the
sizes of those pieces in the table used by the unwinder at runtime.
It will be called by <code class="code">expand_builtin_init_dwarf_reg_sizes</code> after
filling in a single size corresponding to each hard register;
<var class="var">address</var> is the address of the table.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-TARGET_005fASM_005fTTYPE"><span class="category-def">Target Hook: </span><span><code class="def-type">bool</code> <strong class="def-name">TARGET_ASM_TTYPE</strong> <code class="def-code-arguments">(rtx <var class="var">sym</var>)</code><a class="copiable-link" href="#index-TARGET_005fASM_005fTTYPE"> &para;</a></span></dt>
<dd><p>This hook is used to output a reference from a frame unwinding table to
the type_info object identified by <var class="var">sym</var>.  It should return <code class="code">true</code>
if the reference was output.  Returning <code class="code">false</code> will cause the
reference to be output using the normal Dwarf2 routines.
</p></dd></dl>

<dl class="first-deftypevr">
<dt class="deftypevr" id="index-TARGET_005fARM_005fEABI_005fUNWINDER"><span class="category-def">Target Hook: </span><span><code class="def-type">bool</code> <strong class="def-name">TARGET_ARM_EABI_UNWINDER</strong><a class="copiable-link" href="#index-TARGET_005fARM_005fEABI_005fUNWINDER"> &para;</a></span></dt>
<dd><p>This flag should be set to <code class="code">true</code> on targets that use an ARM EABI
based unwinding library, and <code class="code">false</code> on other targets.  This effects
the format of unwinding tables, and how the unwinder in entered after
running a cleanup.  The default is <code class="code">false</code>.
</p></dd></dl>

</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Alignment-Output.html">Assembler Commands for Alignment</a>, Previous: <a href="Dispatch-Tables.html">Output of Dispatch Tables</a>, Up: <a href="Assembler-Format.html">Defining the Output Assembler Language</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
